package com.ml.mall.mapper.catalogue;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ml.mall.bean.req.catalogue.SysCatalogueVariantEditDto;
import com.ml.mall.bean.res.product.SysProductShopPageRes;
import com.ml.mall.bean.vo.catalogue.CatalogueProductPicUrlVo;
import com.ml.mall.entity.catalogue.SysCatalogueProduct;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface SysCatalogueProductMapper extends BaseMapper<SysCatalogueProduct> {


    @Delete("delete sys_catalogue_product from sys_catalogue_product where catalogue_id=#{catalogueId}")
    int delCatelogoryProductByCid(Integer catalogueId);

    //根据companyId来查询相关信息
//    List<SysCatalogueProductQueryAllRes> selectByCompanyId(Long companyId);
    //实现查询缩略图功能
    @Select("select pic_url from sys_catalogue_product where is_delete = 0 and catalogue_id=#{catalogueId}")
    List<CatalogueProductPicUrlVo> selectPicUrlList(Integer catalogueId);

    /**
     * @description    :查询收藏夹所有商品
     * @author         :zxm
     * @date           :2021/5/27
    **/
    List<SysProductShopPageRes> selectCatalogueAllProduct(@Param("catalogueId") Long catalogueId, @Param("companyId") Long companyId);
}
